def id_demo(id):
    if len(id)<=8:
        if id.isalnum() or id.isalpha() or '_' in id:
            print(id)
        else:
            print("你输入的ID不符合规定，请重新输入！")
    else:
        print("你输入的ID长度超过了8位，请重新输入！")

def email_demo(email):
    if '@' in email and email.find('@') != 0:
        if '@' in email[email.find('@') + 1:] or email.find('@') == len(email) - 1:
            print('抱歉！此邮箱无效！请检查您是否输入错误！请重试')
        elif email.find('.') == 0 or email.find('.') == len(email) - 1:
            print('抱歉！此邮箱无效！请检查您是否输入错误！请重试')

        elif abs(email.find('@') - email.find('.')) == 1:
            print('抱歉！此邮箱无效！请检查您是否输入错误！请重试')
        else:
            if '.' in email[email.find('@'):]:
                print('此邮箱有效！验证成功！')

def it_demo(it):

    if len(it) == 18 and it[0] != 0 and it.isdigit():
        sex = int(it[16]) % 2
        if sex ==1:
            print("男")
        elif sex ==0:
            print("女")
        print('您输入的身份证号码有效!\n')

def name_demo(name):

    nl = int((len(name.encode()) - len(name)) // 2)
    for ch in name:
        if not '\u4e00' <= ch <= '\u9fff':
            n = 0
        else:
            n = 1

    if n == 1 and nl <= 4:
        print('名字验证成功！')
    else:
        print("请输入中文名字！")


id = input("请输入ID:")
email = input("请输入email地址：")
it = input("请输入身份证号：")
name = input("请输入姓名：")
id_demo(id)
email_demo(email)
it_demo(it)
name_demo(name)

